package com.edu.exam.enums.examination.paper;

/**
 * 质量状态枚举
 *
 * 从SegmentationQuality实体类中提取的独立枚举
 *
 * @author System
 * @version 1.0.0
 */
public enum QualityStatus {
    EXCELLENT("优秀"),
    GOOD("良好"),
    ACCEPTABLE("可接受"),
    MARGINAL("边缘"),
    POOR("差"),
    VERY_POOR("极差");

    private final String description;

    QualityStatus(String description) {
        this.description = description;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 从描述创建枚举实例
     *
     * @param description 枚举描述
     * @return 对应的枚举实例
     * @throws IllegalArgumentException 如果描述无效
     */
    public static QualityStatus fromDescription(String description) {
        for (QualityStatus status : values()) {
            if (status.getDescription().equals(description)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown quality status description: " + description);
    }

    @Override
    public String toString() {
        return description;
    }
}
